<!-- 公司卡片 -->
<template>
  <view class="company-card">
    <view class="company-card__header">
      <view class="company-card__header--logo">
        <image :src="item.logoUrl" mode="scaleToFill" />
      </view>
      <view class="company-card__header--title"
        >{{ item.companyName }}({{ item.appJobs?.length || 0 }}条)
      </view>
    </view>
    <view class="company-card__job-list">
      <jobCard class="block mt-2" v-for="job in jobList" :key="job.id" :item="job" />
      <view
        class="view-more"
        v-if="item.appJobs && item.appJobs.length > 3 && !showMore"
        @click="showMore = true"
        >查看剩余岗位 <wd-icon name="arrow-down" size="32rpx" color="#FF953E"></wd-icon
      ></view>
    </view>
  </view>
</template>

<script lang="ts" setup>
  import jobCard from '@/pages/components/jobCard.vue';
  const props = defineProps({
    item: {
      type: Object,
      default: () => ({}),
    },
  });
  const showMore = ref(false);
  const jobList = computed(() => {
    if (showMore.value) {
      return props.item.appJobs;
    }
    return props.item.appJobs.slice(0, 3);
  });
</script>

<style lang="scss" scoped>
  .company-card {
    background: linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.65) 0%,
      rgba(255, 255, 255, 0.7) 100%
    );
    border-radius: 20rpx;
    border: 2rpx solid rgba(255, 255, 255, 0.64);
    // border-image: linear-gradient(134deg, , rgba(255, 255, 255, 1)) 2 2;
    padding: 24rpx;
    &__header {
      display: flex;
      &--logo {
        width: 112rpx;
        height: 112rpx;
        border-radius: 16rpx;
        margin-right: 24rpx;
        flex-shrink: 0;
      }
      &--title {
        font-size: 32rpx;
        font-weight: 600;
        color: #191c23;
      }
    }
    &__job-list {
      .view-more {
        margin-top: 32rpx;
        color: $uni-color-primary;
        font-size: 26rpx;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8rpx;
      }
    }
  }
</style>
